package com.example.mark.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.mark.entity.UserData;
import com.example.mark.entity.UserFriendList;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserFriendListMapper extends BaseMapper<UserFriendList> {
    /**
     * 根据ID数组查询用户数据列表
     * @param friendIds 好友ID数组
     * @return 用户数据列表
     */
    @Select("<script>" +
            "SELECT ud.* FROM user_data ud " +
            "WHERE ud.user_id IN " +
            "<foreach collection='friendIds' item='id' open='(' separator=',' close=')'>" +
            "#{id}" +
            "</foreach>" +
            "</script>")
    List<UserData> selectUserDataByIds(@Param("friendIds") String[] friendIds);
}
